#! /bin/bash
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "
create database if not exists zxoe_rpt;

drop table if exists zxoe_rpt.rpt_result;
create table if not exists zxoe_rpt.rpt_result(
    date_time string comment '当天日期',
    class_id string comment '班级id',
    time_slot string comment '时间段(例：上午、下午、晚上)',
    attend_counts bigint comment '出勤人数',
    attend_rate decimal(5,2) comment '出勤率',
    later_counts bigint comment '迟到人数',
    later_rate decimal(5,2) comment '迟到率',
    leave_counts bigint comment '请假人数',
    leave_rate decimal(5,2) comment '请假率',
    truancy_counts bigint comment '旷课人数',
    truancy_rate decimal(5,2) comment '旷课率',
    class_count int comment '班级总人数'
) comment 'RPT层考勤分析主题结果表'
row format delimited
fields terminated by '\t'
stored as orc
tblproperties('orc.compress'='snappy');
"